package com.yitiao.base;

import lombok.SneakyThrows;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class UrlToTitle {
    @SneakyThrows
    public static void main(String[] args) {
        try {
            // 创建一个Document对象，加载网页
            Document doc = Jsoup.connect("https://juejin.cn/post/7273682292538933306").get();

            // 获取网页标题
            String title1 = doc.title();

            // 输出标题
            System.out.println("网页标题: " + title1);

        } catch (IOException e) {
            e.printStackTrace();
        }
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date = "2023-12-31 23:59:59";
        Date parse = format.parse(date);
        System.out.println(format.format(parse));
    }
}

